package com.tanhua.manage.msg;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.tanhua.manage.pojo.RemainingUsers;

import java.util.ArrayList;
import java.util.List;

public class test {
    public static void main(String[] args) {
        DateTime startDay = DateUtil.parse("2020-09-09");
        DateTime endDay = DateUtil.parse("2020-09-19");
        List<DateTime> oo = new ArrayList<>();
        oo.add(startDay);
        int pp = 1;
        if (startDay != null && endDay != null) {
            // 如果都不为空  判断  开始日期是否在结束日期之前
            while (startDay.before(endDay)) {
                // 条件成立 就能期间每一个日期
                startDay = DateUtil.offsetDay(startDay, 1);
                oo.add(startDay);
            }
        }

        for (DateTime dateTime : oo) {
          if (pp == 2 && DateUtil.dayOfMonth(dateTime) % 2 ==0  ){
              System.out.println(dateTime);
              return;
          }
          if (pp == 1 && DateUtil.dayOfMonth(dateTime) % 2 ==1 ){
              System.out.println(dateTime);
              return;
          }
        }
    }
}